var status;

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(f, g, k) {
    if (f == 0) {
        cm.dispose();
        return
    } else {
        status++
    }
    if (status == 0) {
        var b = new Array(Array("每日签到(自由市场)", 13, 120101), Array("给装备砸卷", 21, 120102), Array("使用魔方", 23, 120103), Array("废弃任务", 23, 120104), Array("挑战扎昆", 23, 120105), Array("挑战品克缤", 21, 120106), Array("击杀任意BOSS", 19, 120107), Array("在线360分钟", 20, 120108), Array("在线720分钟", 20, 120109), Array("环任务", 25, 120110), Array("连续签到", 23, 120111), Array("兑换国庆币", 21, 120112), Array("兑换点券", 23, 120113), Array("提升装备品级", 19, 120114));
        var c = cm.getActivity();
        var a = cm.getRecevieReward();
        var m = "#e┌\t\t\t   ─ 今日活跃进度 ─   \t\t\t┐#n\r\n\r\n";
        if (a == -1) {
            m += "      #e#r活跃度：" + c;
            if (c >= cm.getMaxActivity()) {
                m += "(您已经领取了今日所有活跃奖励)"
            } else {
                m += "(距离领取下阶段奖励还需" + cm.getAQNextStageNeed() + "点)"
            }
        } else {
            m += "      #L100##e#r活跃度：" + c + "(点击领取第" + a + "阶段的活跃奖励)#l"
        }
        m += "#k#n\r\n\r\n   任务名称					    活跃度(次)	完成进度\r\n\r\n";
        for (var e = 0; e < b.length; e++) {
            var h = cm.getPlayer().MissionGetFinish(cm.getPlayer().getId(), b[e][2]);
            if (h - cm.getAQMaxTimes(b[e][2]) == 0) {
                m += "#g"
            }
            m += "   " + b[e][0];
            for (var d = b[e][1]; d > 0; d--) {
                m += " "
            }
            m += cm.getAQActivity(b[e][2]) + "点";
            if (cm.getAQActivity(b[e][2]) - 10 < 0) {
                m += " "
            }
            m += "       " + h + "/" + cm.getAQMaxTimes(b[e][2]) + "次\r\n#k"
        }
        m += "#e\r\n└\t\t\t\t\t\t\t\t\t\t\t┘#n";
        cm.sendOkS(m)
    } else {
        if (status == 1) {
            if (k == 100) {
                if (!cm.haveSpace(2)) {
                    cm.sendOk("消耗栏空间不足，请整理后再试。");
                    cm.dispose();
                    return
                }
                var l = cm.getRecevieReward();
                cm.gainItem(2431977 + (l - 1), 1);
                cm.setBossLog("活跃度礼包" + l);
                cm.sendOk("#r第" + l + "阶段活跃度礼包领取成功，快看看有什么好东西吧~");
                cm.worldMessage("[活跃度系统] : 恭喜 " + cm.getPlayer().getName() + " 完成 " + l + " 阶段活跃度成功领取礼包。")
            }
            cm.dispose()
        }
    }
}
var status = -1;